package com.bst.bsj.portal.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class EnumUtil {

	public static Map<String, String> toMap(BaseEnum[] bes) {

		Map<String, String> map = new HashMap<String, String>();
		for (BaseEnum baseEnum : bes) {
			map.put(baseEnum.getCode(), baseEnum.getName());
		}
		return map;
	}

	public static List<Option> toList(BaseEnum[] bes) {
		List<Option> options = new ArrayList<Option>();
		for (BaseEnum baseEnum : bes) {
			options.add(new Option(baseEnum.getName(), baseEnum.getCode()));
		}

		return options;
	}
}
